/*  ProbePorts.java Version 101 - 3rd April 2008
 *  ProbePorts.java uses RXTX to find which ports are avalible
 *  See Versions for program version number
 *  Copyright (C) 2008  Andy Broomfield andy@newmediathinking.com
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
*/

package net.blogbotplatform.blogbot;

import java.util.ArrayList;

import gnu.io.CommPortIdentifier;

public class ProbePorts {
	
    static ArrayList avalibleSerialPorts = new ArrayList();
    static ArrayList avalibleParallelPorts = new ArrayList();
    static CommPortIdentifier portId;
	
	   static void listPorts()
	    {
			avalibleSerialPorts.clear();
			avalibleParallelPorts.clear();
	        java.util.Enumeration portEnum = CommPortIdentifier.getPortIdentifiers();
	        while ( portEnum.hasMoreElements() ) 
	        {
	            portId = (CommPortIdentifier) portEnum.nextElement();
	            //System.out.println(portIdentifier.getName()  +  " - " +  getPortTypeName(portIdentifier.getPortType()) );
      			//populate an array list with port names
      			if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) avalibleSerialPorts.add(portId.getName());
      			if (portId.getPortType() == CommPortIdentifier.PORT_PARALLEL) avalibleParallelPorts.add(portId.getName());
	        }        
	    }

}
